Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

- F include py.typed #184

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JayBazuzi
Copy link
Contributor

@JayBazuzi JayBazuzi commented Nov 4, 2024

Fixes #179.

I put this outside of a pytest because it's pretty slow. Maybe there's a better way?

Summary by Sourcery

Tests:

  • Add a test to verify the existence of py.typed files in the package distributions.

Copy link

sourcery-ai bot commented Nov 4, 2024

Reviewer's Guide by Sourcery

This PR adds a new test environment in tox to verify the presence of py.typed files in the built packages. The implementation creates a temporary test file that imports the packages and runs mypy on it to ensure type checking works correctly. The test builds wheel distributions of the packages, installs them, and verifies they can be properly type-checked.

Sequence diagram for the py.typed file verification process

sequenceDiagram
    participant Developer
    participant Tox
    participant TestScript as test__py_typed_files_exist.py
    participant Mypy
    participant Pip
    participant WheelBuilder as Wheel Builder

    Developer->>Tox: Run test environment
    Tox->>TestScript: Execute test__py_typed_files_exist.py
    TestScript->>WheelBuilder: Build wheel for approval_utilities
    WheelBuilder-->>TestScript: Return wheel
    TestScript->>Pip: Install wheel
    Pip-->>TestScript: Confirm installation
    TestScript->>Mypy: Run mypy on temporary test file
    Mypy-->>TestScript: Return type check result
    TestScript->>WheelBuilder: Build wheel for approvaltests
    WheelBuilder-->>TestScript: Return wheel
    TestScript->>Pip: Install wheel
    Pip-->>TestScript: Confirm installation
    TestScript->>Mypy: Run mypy on temporary test file
    Mypy-->>TestScript: Return type check result
Loading

File-Level Changes

Change Details Files
Added a new tox test environment for py.typed verification
  • Created new test environment 'test__py_typed_files_exist'
  • Added dependency on requirements.txt for the new test environment
tox.ini
Implemented py.typed verification test script
  • Created script to build wheel distributions of packages
  • Added functionality to install built packages with force-reinstall
  • Implemented mypy verification using temporary test files
  • Added helper function for running Python commands with error checking
test__py_typed_files_exist.py

Assessment against linked issues

Issue Objective Addressed Explanation
#179 Add py.typed marker files to fix mypy import-untyped error While the PR adds a test to verify py.typed files exist, it doesn't actually add the py.typed files themselves. The test would currently fail since the files aren't added in this PR.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@nitsanavni
Copy link
Contributor

I don't understand, discuss Sunday?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mypy reports missing library stubs or py.typed marker
2 participants